{% extends "layouts/default.html.twig" %}

{% block title %}{{ 'Job logs'|trans }}{% endblock %}

{% block body %}
    <div class="container-fluid">
        {{ include('partials/_page_header.html.twig', {header: 'Job logs'|trans, description: 'Bacula job log'|trans}) }}

        <div class="row">
            <div class="col-3">
                <div class="card">
                    <div class="card-header">{{ 'Job details'|trans }}</div>
                    <div class="card-body">
                        <h5 class="card-title">{{ 'Job id'|trans }}</h5>
                        <p class="card-text">{{ job.jobid }}</p>

                        <h5 class="card-title">{{ 'Job name'|trans }}</h5>
                        <p class="card-text">{{ job.job_name }}</p>

                        <h5 class="card-title">{{ 'Job status'|trans }}</h5>
                        <p class="card-text">{{ job.jobstatuslong }}</p>

                        <h5 class="card-title">{{ 'Job bytes'|trans }}</h5>
                        <p class="card-text">{{ job.getJobBytes() }}</p>

                        <h5 class="card-title">{{ 'Scheduled time'|trans }}</h5>
                        <p class="card-text">{{ job.schedtime }}</p>

                        <h5 class="card-title">{{ 'Job start time'|trans }}</h5>
                        <p class="card-text">{{ job.starttime }}</p>

                        <h5 class="card-title">{{ 'Job end time'|trans }}</h5>
                        <p class="card-text">{{ job.endtime }}</p>

                        <h5 class="card-title">{{ 'Job level'|trans }}</h5>
                        <p class="card-text">{{ job.getLevel() }}</p>

                        <h5 class="card-title">{{ 'Pool'|trans }}</h5>
                        <p class="card-text">{{ job.pool_name }}</p>
                    </div>
                </div>
            </div>
            <div class="col-9">
                <div class="table-responsive">
                    <table class="table table-hover table-striped table-condensed table-bordered">
                        <caption>Job event(s) list</caption>
                        <thead>
                        <tr>
                            <th class="text-center">{{ 'Time'|trans }}</th>
                            <th class="text-center">{{ 'Event'|trans }}</th>
                        </tr>
                        </thead>
                        {% for log in joblogs %}
                            <tr>
                                <td class="text-center">{{ log.time }}</td>
                                <td class="text-left">{{ log.logtext|nl2br }}</td>
                            </tr>
                        {% else %}
                            <tr>
                                <td colspan="2" class="text-center">{{ 'No log(s) for this job'|trans }}</td>
                            </tr>
                        {% endfor %}
                    </table>
                </div>
            </div>
        </div>
    </div>
{% endblock %}